package webModule
{
	import com.greensock.TweenMax;
	import com.touchX.display.AbstractDisplay;
	
	import flash.events.Event;
	
	import webModule.menu.MenuEvent;
	import webModule.menu.MenuItem;
	
	public class Menu extends AbstractDisplay
	{
		private var menuList:Array=["关于我们","产品系列","联系我们"];
		public function Menu()
		{
			super();
			initMenus(menuList);
		}
		private function initMenus(list:Array):void{
			for(var i:int=0;i<list.length;i++){
				var item:MenuItem=new MenuItem(list[i],i);
				item.x=i*(item.width+5);
				addChild(item);
				TweenMax.from(item,(i+1)*.5,{y:-200,delay:.5});
				item.addEventListener(MenuEvent.MENU_SELECTED,menuSelected);
			}
		}
		protected override function added(event:Event):void{
			super.added(event);
			TweenMax.from(this,1,{y:-200});
		}
		private function menuSelected(evt:MenuEvent):void{
			this.dispatchEvent(evt);
		}
	}
}